package com.taotao.manage.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.github.abel533.entity.Example;
import com.github.pagehelper.PageInfo;
import com.taotao.common.utils.EasyUIResult;
import com.taotao.manage.pojo.Content;

@Service
public class ContentService extends BaseService<Content> {

	/**
	 * 根据内容ID进行分页查询
	 * @param categoryId
	 * @param page
	 * @param rows
	 * @return
	 */
	public EasyUIResult queryContentListByUpdatedTimeDESC(Long categoryId, Integer page,
			Integer rows) {
			//创建example对象
			Example example = new Example(Content.class);
			//根据时间进行倒叙查询数据
			example.setOrderByClause("updated DESC");
			//根据categoryId查询数据
			example.createCriteria().andEqualTo("categoryId", categoryId);
			PageInfo<Content> pageInfo = super.queryPageListByExample(example, page, rows);
			return new EasyUIResult(pageInfo.getTotal(),pageInfo.getList());
			
	}
	/**
	 * 根据content 的id值批量删除
	 * @param ids
	 */
	public Integer deleteContentByIds(List<Object> ids) {
		
		return super.deleteByIds(ids, "id", Content.class);
	}

}
